(function($) {
    var arkflow = $.arkflow;

    // 节点大小调整器
    arkflow.Resizer = Base.extend({
        constructor: function(bindNode, paper, onResizer) {
	        this.bindNode = bindNode;
	        this.paper = paper;
	        this.onResizer = onResizer;
	
	        this._bx = 0;
	        this._by = 0;
	
	        this.init();
        },
        // 选中节点周围矩形线的尺寸
        resizePointSize : 5,
        init: function() {
            var me = this;

            // 节点的位置和尺寸属性
            this.resizeInfo = {
                x : this.bindNode.attr.x - this.bindNode.margin,
                y : this.bindNode.attr.y - this.bindNode.margin,
                width : this.bindNode.attr.width + this.bindNode.margin * 2,
                height : this.bindNode.attr.height + this.bindNode.margin * 2
            };

            this.comps = [];
            this.comps.push(new arkflow.ResizerPath(this));
            // 8 points
            this.comps.push(new arkflow.LeftTopResizerPoint(this));
            this.comps.push(new arkflow.LeftResizerPoint(this));
            this.comps.push(new arkflow.LeftBottomResizerPoint(this));
            this.comps.push(new arkflow.TopResizerPoint(this));
            this.comps.push(new arkflow.BottomResizerPoint(this));
            this.comps.push(new arkflow.RightTopResizerPoint(this));
            this.comps.push(new arkflow.RightResizerPoint(this));
            this.comps.push(new arkflow.RightBottomResizerPoint(this));
        },

        // 记录尺寸更改后X、Y坐标
        resetPosition: function(x, y, F) {
            this._bx = x;
            this._by = y;
        },
        redraw: function() {
            for(var i=0; i<this.comps.length; i++) {
                this.comps[i].redraw();
            }
        },
        // 选中节点周围框显示
        show : function() {
            for(var i=0; i<this.comps.length; i++) {
                this.comps[i].show();
            }
        },
        // 选中节点周围框隐藏
        hide : function() {
            for(var i=0; i<this.comps.length; i++) {
                this.comps[i].hide();
            }
        },
        destory: function() {
            for(var i=0; i<this.comps.length; i++) {
                this.comps[i].remove();
            }
        }
	});

})(jQuery);